import { RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';

import { PagesComponent } from './pages.component';
import {LocationDocumentComponent} from './location-document/location-document.component';
import { BuildingDocumentComponent } from './building-document/building-document.component';
import {UnitDocumentComponent} from "./unit-document/unit-document.component";
import {UserDocumentComponent} from "./user-document/user-document.component";
import {DeviceDocumentComponent} from "./device-document/device-document.component";
import {UnitBillComponent} from "./bill/unit-bill.component";
import {EleHistoryComponent} from "./ele-history/ele-history.component";
import {OtherHistoryComponent} from "./other-history/other-history.component";
import {DeviceCtrlComponent} from "./device-control/device-ctrl.component";
import {BillResultComponent} from "./bill-result/bill-result.component";
import {ManageSystemComponent} from "./manage-system/manage-system.component";
import {ManageAdminComponent} from "./manage-admin/manage-admin.component";
import {UserProfileComponent} from "./user-system/user-profile.component";
import {UserDevComponent} from "./user-system/user-dev.component";
import {IndexComponent} from "./index/index.component";
import {UserBillComponent} from "./user-system/user-bill.component";
import {CostListComponent} from "./cost-list/cost-list.component";
import {DeviceDetailComponent} from "./device-document/device-detail.component";
import {UserChargeComponent} from "./user-system/user-charge.component";
import {UnitDetailComponent} from "./unit-document/unit-detail.component";
import {DeviceLogComponent} from "./device-document/device-log.component";

const routes: Routes = [{
  path: '',
  component: PagesComponent,
  children: [
    {
      path: 'index',
      component:IndexComponent
    },
    {
      path: 'doc/ld',
      component: LocationDocumentComponent,
    },
    {
      path: 'doc/bd',
      component: BuildingDocumentComponent,
    },
    {
      path: 'doc/bd/:ld',
      component: BuildingDocumentComponent,
    },
    {
      path: 'doc/ud',
      component: UnitDocumentComponent,
    },
    {
      path: 'doc/ud/bd/:bd',
      component: UnitDocumentComponent,
    },
    {
      path: 'doc/ud/ud',
      component: UnitDetailComponent,
    },
    {
      path: 'doc/urd',
      component: UserDocumentComponent,
    },
    {
      path: 'doc/urd/:unitId',
      component: UserDocumentComponent
    },
    {
      path: 'doc/dl',
      component: DeviceDocumentComponent,
    },
    {
      path: 'doc/dl/:unitId',
      component: DeviceDocumentComponent
    },
    {
      path: 'doc/bl',
      component: UnitBillComponent
    },
    {
      path: 'doc/bl/:unitId',
      component: UnitBillComponent
    },
    {
      path: 'doc/br',
      component: BillResultComponent
    },
    {
      path: 'doc/br/:unitId',
      component: BillResultComponent
    },
    {
      path: 'doc/cost',
      component: CostListComponent
    },
    {
      path: 'history/ele',
      component: EleHistoryComponent
    },{
      path: 'history/ele/:deviceId',
      component:EleHistoryComponent
    },
    {
      path: 'history/other',
      component: OtherHistoryComponent
    },
    {
      path: 'history/other/:deviceId',
      component:OtherHistoryComponent
    },
    {
      path: 'dev/ctrl',
      component: DeviceCtrlComponent
    },
    {
      path: 'dev/log',
      component:DeviceLogComponent
    },
    {
      path: 'dev/detail/:devNo',
      component: DeviceDetailComponent
    },
    {
      path: 'mng/sys',
      component:ManageSystemComponent
    },
    {
      path: 'mng/adm',
      component:ManageAdminComponent
    },
    {
      path:'usr',
      children:[
        {
          path:'profile',
          component:UserProfileComponent
        },
        {
          path: 'dev',
          component:UserDevComponent
        },
        {
          path: 'bill',
          component:UserBillComponent
        },
        {
          path: 'charge',
          component:UserChargeComponent
        }
      ]
    },

  ],
}];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class PagesRoutingModule {
}
